package com.paic.du.lib;

public class Utils {

	public static int [] ori={54,2,4,43,2,32,21,6,-4,-4,-53};
	public static void swap(int []ori, int i, int j)
	{
		int tmp=ori[i];
		ori[i]=ori[j];
		ori[j]=tmp;
	}
	public static int max(int i, int j){
		return i>j?i:j;
	}
		
	public static int max(int []ori, int i, int j)
	{
		return ori[i]>ori[j]?i:j;
	}
	
	public static int min(int []ori, int i, int j){
		return ori[i]<ori[j]?i:j;
	}
	public static int min(int i, int j){
		return i<j?i:j;
	}
	
	/**
	 * 返回sum(m)>j的最小m
	 * @param j
	 * @return
	 */
	public static int minSum(int j){
		int m=0;
		while(m*(m+1)/2<=j)
			m++;
		return m;
	}
}
